package com.androidx.p013lv.mine.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.mine.C1207R;
import com.androidx.p013lv.mine.bean.GroupBean;
import java.util.ArrayList;
import java.util.List;

/* renamed from: com.androidx.lv.mine.adapter.AdapterAddGroup */
public class AdapterAddGroup extends BaseAdapter {
    double height;
    Context mContext;
    List<GroupBean> mList = new ArrayList();

    public long getItemId(int i) {
        return (long) i;
    }

    public AdapterAddGroup(Context context) {
        this.mContext = context;
        this.height = (double) ((((UiUtils.getWindowWidth() - UiUtils.dp2px(23)) / 2) * 124) / 188);
    }

    public void setList(List<GroupBean> list) {
        this.mList = list;
        notifyDataSetChanged();
    }

    public int getCount() {
        return this.mList.size();
    }

    public GroupBean getItem(int i) {
        return this.mList.get(i);
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder;
        if (view == null) {
            view = LayoutInflater.from(this.mContext).inflate(C1207R.C1212layout.item_add_group, viewGroup, false);
            viewHolder = new ViewHolder();
            viewHolder.tv_name = (TextView) view.findViewById(C1207R.C1210id.tv_name);
            viewHolder.iv_cover = (ImageView) view.findViewById(C1207R.C1210id.iv_cover);
            viewHolder.ll_content = (LinearLayout) view.findViewById(C1207R.C1210id.ll_content);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        ViewGroup.LayoutParams layoutParams = viewHolder.ll_content.getLayoutParams();
        layoutParams.height = (int) this.height;
        viewHolder.ll_content.setLayoutParams(layoutParams);
        GroupBean groupBean = this.mList.get(i);
        viewHolder.tv_name.setText(groupBean.getName());
        int groupType = groupBean.getGroupType();
        if (groupType == 1) {
            viewHolder.iv_cover.setImageResource(C1207R.C1209drawable.mine_ic_telegram);
        } else if (groupType == 2) {
            viewHolder.iv_cover.setImageResource(C1207R.C1209drawable.mine_ic_potato);
        } else if (groupType == 3) {
            viewHolder.iv_cover.setImageResource(C1207R.C1209drawable.mine_ic_qq);
        } else if (groupType == 4) {
            viewHolder.iv_cover.setImageResource(C1207R.C1209drawable.mine_ic_wx);
        }
        return view;
    }

    /* renamed from: com.androidx.lv.mine.adapter.AdapterAddGroup$ViewHolder */
    class ViewHolder {
        ImageView iv_cover;
        LinearLayout ll_content;
        TextView tv_name;

        ViewHolder() {
        }
    }
}
